
const path = require('path')

function resolve (dir) {
  return path.join(__dirname, dir)
}

module.exports = {
  lintOnSave: false,
  devServer: {
    port: '8080',
    open: true,
    hot: true,
    clientLogLevel: 'warning',
    overlay: {
      warnings: false,
      errors: true
    }
  },
  configureWebpack: {
    // provide the app's title in webpack's name field, so that
    // it can be accessed in index.html to inject the correct title.
    name: 'dfdf',
    resolve: {
      alias: {
        '@': resolve('src')
      }
    }
  },
  chainWebpack (config) {
    config.module
      .rule('svg')
      .exclude.add(resolve('src/icons'))
      .end()
    config.module
      .rule('icons')
      .test(/\.svg$/)
      .include.add(resolve('src/icons'))
      .end()
      .use('svg-sprite-loader')
      .loader('svg-sprite-loader')
      .options({
        symbolId: 'icon-[name]'
      })
      .end()
  },
  devServer: {
    proxy: {
      '/index.php': {
        target: 'http://preapiconsole.71360.com/api/app/obor-nginx-php/',
        changeOrigin: true,
        pathRewrite: {
          '^/index.php': ''
        }
      },
      '/index_upload.php': {
        // target:'https://api.71360.com/api/app/obor-nginx-php/',
        target: 'https://preapiconsole.71360.com/',
        changeOrigin: true,
        pathRewrite: {
          '^/index_upload.php': ''
        }
      },
      '/index.java': {
        target: 'http://luying2.oa.nbseo.cn/',
        changeOrigin: true,
        pathRewrite: {
          '^/index.java': ''
        }
      }
    }
  }
}
